package tech.aistar.controller;


import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 本类用来演示: HelloController
 *
 * @author: success
 * @date: 2021/5/8 9:32 上午
 */
public class HelloController implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        //Model - 模型
        //View - 逻辑视图
        //ModelAndView - springmvc底层的对象
        ModelAndView modelAndView = new ModelAndView();

        //request作用域
        modelAndView.addObject("username","tom");

        //设置逻辑视图
        modelAndView.setViewName("/WEB-INF/hello/hello.jsp");
        return modelAndView;
    }
}
